﻿using mvcForum.Core.Interfaces.Data;
using System;
using System.Linq.Expressions;


namespace mvcForum.Core.Specifications {

	public static class FollowTopicSpecifications {

		public class SpecificTopic : ISpecification<FollowTopic> {
			private readonly Topic topic;

			public SpecificTopic(Topic topic) {
				this.topic = topic;
			}

			public Expression<Func<FollowTopic, Boolean>> IsSatisfied {
				get {
					return x => x.TopicId == topic.Id;
				}
			}
		}

		public class SpecificTopicAndUser : ISpecification<FollowTopic> {
			private readonly Topic topic;
			private readonly ForumUser user;

			public SpecificTopicAndUser(Topic topic, ForumUser user) {
				this.topic = topic;
				this.user = user;
			}

			public Expression<Func<FollowTopic, Boolean>> IsSatisfied {
				get {
					return x => x.TopicId == topic.Id && x.ForumUserId == user.Id;
				}
			}
		}
	}
}